<?php

namespace app\api\controller;

use app\admin\model\hotel\HotelRoomType;
use app\api\model\hotel\HotelRoom as HotelRoomModel;
use app\common\controller\Api;
use app\common\model\hotel\Hotel as HotelModel;

class Hotel extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];


    //房型列表
    public function houseRoomTypeList()
    {

        $hotel_id = input('hotel_id',0);
        $page = input('page',1);
        $page_size = input('page_size',100);
        $hotel = new HotelModel();

        $new_list = [];

        $list = HotelRoomType::order('weigh desc')->select();

        $res = $hotel->room_type_list($hotel_id,$page,$page_size);

        $room_model = new HotelRoomModel;

        foreach ($list as $k=>$v){
            foreach ($res['list'] as $kk=>$vv){
                if ($v['room_type_name']==$vv['room_type_name']){
                    //if ($this->auth->id){
                        $member_price = $room_model->getRoomDiscountPrice($v['id']);
                        $vv['member_price'] = $member_price['member_price'];
                    //}

                    $vv['price'] = $v['price'];
                    $new_list[] = $vv;
                }
            }
        }
        $this->success('',$new_list);
    }

}